import { request } from '../request';

export function noticeList(
  params: {
    type: number;
  } & Api.PageParam,
) {
  return request<
    Api.PageVO<
      {
        noticeTime: string;
        articleTitle: string;
        comment: string;
        createUserInfo: {
          id: string;
          username: string;
          avatar: string;
          summary: string;
        };
      } & Api.NoticeInfo
    >
  >({
    url: '/notice/list',
    method: 'post',
    data: params,
  });
}

export function noticeArt(
  params: {
    order: 'create_time' | string;
  } & Api.PageParam,
) {
  return request<
    Api.PageVO<
      {
        noticeTime: string;
        articleTitle: string;
        createUserInfo: {
          id: string;
          username: string;
          avatar: string;
          summary: string;
        };
      } & Api.NoticeInfo
    >
  >({
    url: '/notice/art',
    method: 'post',
    data: params,
  });
}

export function noticePeople(
  params: {
    order: 'create_time' | string;
  } & Api.PageParam,
) {
  return request<
    Api.PageVO<
      {
        noticeTime: string;
        createUserInfo: {
          id: string;
          username: string;
          avatar: string;
          summary: string;
        };
      } & Api.NoticeInfo
    >
  >({
    url: '/notice/people',
    method: 'post',
    data: params,
  });
}

export function noticeFavorite(
  params: {
    order: 'create_time' | string;
  } & Api.PageParam,
) {
  return request<
    Api.PageVO<
      {
        noticeTime: string;
        comment: string;
        articleTitle: string;
        createUserInfo: {
          id: string;
          username: string;
          avatar: string;
          summary: string;
        };
      } & Api.NoticeInfo
    >
  >({
    url: '/notice/favorite',
    method: 'post',
    data: params,
  });
}

export function noticeTag() {
  return request<{
    listFlag: boolean;
    peopleFlag: boolean;
    favoriteFlag: boolean;
    hideRed: boolean;
    noticeType: {
      [key: number]: string;
    };
  }>({
    url: '/notice/tag',
    method: 'post',
  });
}
export function noticeFlag(param: { tab: string }) {
  return request<boolean>({
    url: '/notice/flag',
    method: 'post',
    data: param,
  });
}

export function noticeHideRed(param: { bool: boolean }) {
  return request<boolean>({
    url: '/notice/hide-red',
    method: 'post',
    data: param,
  });
}

export function noticeInit() {
  return request<Array<Api.SelectVO>>({
    url: '/notice/init',
    method: 'get',
  });
}
